<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        body{
            margin: 0px;
        }
        #div{
            width: 400px;
            height: 2000px;
            background:gray;
            position: absolute;
            left: 50px;
            top: 50px;
        }
        .div{
            width: 100px;
            height: 100px;
        }
        /*fixed 任何时候，div的绝对布局都是参考浏览器边框*/
        #d1{
            background: #008B8B;
            position: fixed;
            left: 100px;
            top:100px
        }
        #d2{
            background: rebeccapurple;
        }
        #d3{
            background: orange;
        }
        /*relative 相对布局，就是设置HTML标签（div）相对于自己原来的位置的偏移量*/
        #d4{
            background: aqua;
            position: relative;
            left: 100px;
            top: 100px;
        }
        .span{
            width: 50px;
            height: 50px;
        }
        #s1{
            background: orange;
        }
        #s2{
            background: green;
        }
    </style>
</head>
<body>
<div id="div">
    <div id="d1" class="div">div1</div>
    <div id="d2" class="div">div2</div>
    <div id="d3" class="div">div3</div>
    <div id="d4" class="div">div4</div>
</div>

<!--<span id="s1" class="span">span1</span>-->
<!--<span id="s2" class="span">span2</span>-->

</div>

</body>
</html>